# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Rafael Fontenelle <rafaelff@gnome.org>

_pyname=arpy
pkgname=python-${_pyname}
pkgver=2.3.0
pkgrel=3
pkgdesc='Library for accessing ar files'
url='https://github.com/viraptor/arpy'
arch=('any')
license=('custom:BSD')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
checkdepends=('python-pytest')
source=("${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('7479d713df8da3d18fe477c7ae585f476bd1b278ac7a2bb11f9834071148178f17f8a18db3189f6f946f2f3f8f444bf5239c2c01d631d1a575e86b7556d3e835')
b2sums=('0c22127a8221e02df4814ff23ad13e43968553e4b8a8544a9ed826b57261f1b20bd35212202d02454f3cbfcb3d3ceaac092abb0c0a1b67481f0930d191a5e202')

prepare() {
  cd ${_pyname}-${pkgver}
  head -n30 arpy.py > LICENSE
}

build() {
  cd ${_pyname}-${pkgver}
  python -m build --wheel --no-isolation
}

check() {
  cd ${_pyname}-${pkgver}
  PYTHONPATH=build/lib pytest
}

package() {
  cd ${_pyname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
